CFLAGS = -Wall -fpic -coverage -lm -fprofile-arcs -ftest-coverage

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)

testDrawCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
	gcc -o badTestDrawCard -g  badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testBuyCard.c dominion.o rngs.o
	gcc -o testBuyCard -g  testBuyCard.c dominion.o rngs.o $(CFLAGS)

testAll: dominion.o testSuite.c
	gcc -o testSuite testSuite.c -g  dominion.o rngs.o $(CFLAGS)

unittest1: unittest1.c dominion.o rngs.o
	gcc -o unittest1 -g  unittest1.c dominion.o rngs.o $(CFLAGS)

unittest2: unittest2.c dominion.o rngs.o
	gcc -o unittest2 -g  unittest2.c dominion.o rngs.o $(CFLAGS)

unittest3: unittest3.c dominion.o rngs.o
	gcc -o unittest3 -g  unittest3.c dominion.o rngs.o $(CFLAGS)

unittest4: unittest4.c dominion.o rngs.o
	gcc -o unittest4 -g  unittest4.c dominion.o rngs.o $(CFLAGS)

cardtest1: cardtest1.c dominion.o rngs.o
	gcc -o cardtest1 -g  cardtest1.c dominion.o rngs.o $(CFLAGS)

cardtest2: cardtest2.c dominion.o rngs.o
	gcc -o cardtest2 -g  cardtest2.c dominion.o rngs.o $(CFLAGS)

cardtest3: cardtest3.c dominion.o rngs.o
	gcc -o cardtest3 -g  cardtest3.c dominion.o rngs.o $(CFLAGS)

cardtest4: cardtest4.c dominion.o rngs.o
	gcc -o cardtest4 -g  cardtest4.c dominion.o rngs.o $(CFLAGS)

unittestresults.out: unittest1 unittest2 unittest3 unittest4 cardtest1 cardtest2 cardtest3 cardtest4 dominion.o rngs.o
	-./unittest1
	-./unittest2
	-./unittest3
	-./unittest4
	-./cardtest1
	-./cardtest2
	-./cardtest3
	-./cardtest4
	-gcov -b -f dominion.c 1>> unittestresults.out

randomtestadventurer: randomtestadventurer.c dominion.o rngs.o
	gcc -o randomtestadventurer -g  randomtestadventurer.c dominion.o rngs.o $(CFLAGS)

randomtestadventurer.out: randomtestadventurer dominion.o rngs.o
	-./randomtestadventurer -v 1>> randomtestadventurer.out
	-gcov -b -f dominion.c 1>> randomtestadventurer.out

randomtestcard: randomtestcard.c dominion.o rngs.o
	gcc -o randomtestcard -g  randomtestcard.c dominion.o rngs.o $(CFLAGS)

randomtestcard.out: randomtestcard dominion.o rngs.o
	-./randomtestcard -v 1>> randomtestcard.out
	-gcov -b -f dominion.c 1>> randomtestcard.out

testdominion: testdominion.c dominion.o rngs.o
	gcc -o testdominion -g  testdominion.c dominion.o rngs.o $(CFLAGS)

testdominion.out: testdominion dominion.o rngs.o
	-./testdominion
	-gcov -b -f dominion.c 1>> testdominion.out

testfulldeckcount: testfulldeckcount.c dominion.o rngs.o
	gcc -o testfulldeckcount -g  testfulldeckcount.c dominion.o rngs.o $(CFLAGS)

testcompare: testcompare.c dominion.o rngs.o
	gcc -o testcompare -g  testcompare.c dominion.o rngs.o $(CFLAGS)

testgetwinners: testgetwinners.c dominion.o rngs.o
	gcc -o testgetwinners -g  testgetwinners.c dominion.o rngs.o $(CFLAGS) 

testcardsalvager: testcardsalvager.c dominion.o rngs.o
	gcc -o testcardsalvager -g  testcardsalvager.c dominion.o rngs.o $(CFLAGS)

testcardambassador: testcardambassador.c dominion.o rngs.o
	gcc -o testcardambassador -g  testcardambassador.c dominion.o rngs.o $(CFLAGS)

testcardtribute: testcardtribute.c dominion.o rngs.o
	gcc -o testcardtribute -g  testcardtribute.c dominion.o rngs.o $(CFLAGS)

testcardseahag: testcardseahag.c dominion.o rngs.o
	gcc -o testcardseahag -g  testcardseahag.c dominion.o rngs.o $(CFLAGS)

testcardtreasuremap: testcardtreasuremap.c dominion.o rngs.o
	gcc -o testcardtreasuremap -g  testcardtreasuremap.c dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

all: playdom player testDrawCard testBuyCard badTestDrawCard unittest1 unittest2 unittest3 unittest4 cardtest1 cardtest2 cardtest3 cardtest4 randomtestadventurer randomtestcard testdominion testfulldeckcount testcompare testgetwinners testcardsalvager testcardambassador testcardtribute testcardseahag testcardtreasuremap

clean:
	rm -f *.o playdom.exe playdom test.exe test player player.exe testDrawCard testDrawCard.exe testBuyCard testBuyCard.exe badTestDrawCard badTestDrawCard.exe unittest1 unittest1.exe unittest2 unittest2.exe unittest3 unittest3.exe unittest4 unittest4.exe cardtest1 cardtest1.exe cardtest2 cardtest2.exe cardtest3 cardtest3.exe cardtest4 cardtest4.exe randomtestadventurer randomtestadventurer.exe randomtestcard randomtestcard.exe testdominion testdominion.exe testfulldeckcount testfulldeckcount.exe testcompare testcompare.exe testgetwinners testgetwinners.exe testcardsalvager testcardsalvager.exe testcardambassador testcardambassador.exe testcardtribute testcardtribute.exe testcardseahag testcardseahag.exe testcardtreasuremap testcardtreasuremap.exe *.gcov *.gcda *.gcno *.so
